/*
 * @Author: RAY_HUI 1541917867@qq.com
 * @Date: 2025-07-11 14:47:59
 * @LastEditors: RAY_HUI 1541917867@qq.com
 * @LastEditTime: 2025-07-11 15:09:53
 * @FilePath: \elegant-admin-main\src\mock\manager_mes.ts
 * @Description:
 *
 * Copyright (c) 2025 by ${git_name_email}, All Rights Reserved.
 */
import { defineFakeRoute } from 'vite-plugin-fake-server/client'
import Mock from 'mockjs'

export default defineFakeRoute([
  // 🔹 获取消息列表分页数据
  {
    url: '/mock/admin/Message/page',
    method: 'post',
    response: () => {
      return {
        code: 200,
        message: 'success',
        ok: true,
        data: Mock.mock({
          'total': 100,
          'records|10': [
            {
              'id|+1': 1,
              'title': '@ctitle(5, 10)',
              'content': '@cparagraph(1, 3)',
              'sender': '@cname',
              'status|1': ['ENABLED', 'DISABLED'],
              'createTime': '@datetime("yyyy-MM-dd HH:mm:ss")',
            },
          ],
        }),
      }
    },
  },

  // 🔹 新增消息
  {
    url: '/mock/admin/message/save',
    method: 'post',
    response: () => {
      return {
        code: 200,
        message: '新增成功',
        ok: true,
        data: Mock.Random.guid(), // 返回一个模拟 ID
      }
    },
  },

  // 🔹 编辑消息
  {
    url: '/mock/admin/message/update',
    method: 'put',
    response: () => {
      return {
        code: 200,
        message: '更新成功',
        ok: true,
        data: true,
      }
    },
  },

  // 🔹 删除消息
  {
    url: '/mock/admin/message/delete',
    method: 'delete',
    response: () => {
      return {
        code: 200,
        message: '删除成功',
        ok: true,
        data: true,
      }
    },
  },
])
